#include<bits/stdc++.h>

using namespace std;

class Solution {
public:
    int nums[3];
    int count = 0;
    void back(int start, int n, int limit, int j)
    {
        if (n < 0)
        {
            return;
        } 
        if (n == 0)
        {
            count++;
            return;
        }

        for (int i = start; i >= 1; i--)
        {
            if (n >= i)
            {
                nums[j] = i;
                n -= i;
                back(limit, n, limit, j + 1);
                n += i;
            }
        }
    }
    int distributeCandies(int n, int limit) {
        back(limit, n, limit, 0);



        return count;
    }
};

int main()
{
    Solution s;
    s.distributeCandies(5, 2);

    return 0;
}